using System.Collections.Generic;
using System.Linq;

namespace GuitarChordFinder
{
    /// <summary>
    /// References one possible (usually the most common) audio for a chord
    /// </summary>
    public class ChordAudioData
    {
        public List<ChordAudio> ChordAudioList { get; set; }
        private NoteData noteData = new NoteData();
        private ChordTypeData chordTypeData = new ChordTypeData();

        public ChordAudioData()
        {
            ChordType majorChordType = chordTypeData.ChordTypeList.Where(ct => ct.Code == "Major").First();
            ChordType minorChordType = chordTypeData.ChordTypeList.Where(ct => ct.Code == "Minor").First();
            ChordAudioList = new List<ChordAudio>
                                 {
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "A").First(), 
                                         ChordType = majorChordType, AudioFile = "Amajor.mp3"}, 
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "A").First(), 
                                         ChordType = minorChordType, AudioFile = "Aminor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "A#").First(), 
                                         ChordType = majorChordType,  AudioFile = "Asharpmajor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "A#").First(), 
                                         ChordType = minorChordType, AudioFile = "Asharpminor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "B").First(), 
                                         ChordType = majorChordType,  AudioFile = "Bmajor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "B").First(), 
                                         ChordType = minorChordType, AudioFile = "Bminor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "C").First(), 
                                         ChordType = majorChordType,  AudioFile = "Cmajor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "C").First(), 
                                         ChordType = minorChordType, AudioFile = "Cminor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "C#").First(), 
                                         ChordType = majorChordType,  AudioFile = "Csharpmajor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "C#").First(), 
                                         ChordType = minorChordType, AudioFile = "Csharpminor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "D").First(), 
                                         ChordType = majorChordType,  AudioFile = "Dmajor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "D").First(), 
                                         ChordType = minorChordType, AudioFile = "Dminor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "D#").First(), 
                                         ChordType = majorChordType,  AudioFile = "Dsharpmajor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "D#").First(), 
                                         ChordType = minorChordType, AudioFile = "Dsharpminor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "E").First(), 
                                         ChordType = majorChordType,  AudioFile = "Emajor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "E").First(), 
                                         ChordType = minorChordType, AudioFile = "Eminor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "F").First(), 
                                         ChordType = majorChordType,  AudioFile = "Fmajor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "F").First(), 
                                         ChordType = minorChordType, AudioFile = "Fminor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "F#").First(), 
                                         ChordType = majorChordType,  AudioFile = "Fsharpmajor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "F#").First(), 
                                         ChordType = minorChordType, AudioFile = "Fsharpminor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "G").First(), 
                                         ChordType = majorChordType,  AudioFile = "Gmajor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "G").First(), 
                                         ChordType = minorChordType, AudioFile = "Gminor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "G#").First(), 
                                         ChordType = majorChordType,  AudioFile = "Gsharpmajor.mp3"},
                                     new ChordAudio{Note = noteData.NoteList.Where(n => n.Code == "G#").First(), 
                                         ChordType = minorChordType, AudioFile = "Gsharpminor.mp3"},
                                 };
        }
    }
}